package com.fin.zw.intelligentbot.entity;


import com.fin.zw.intelligentbot.enums.SourceType;
import lombok.Data;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(appliesTo = "variable",comment = "机器人说话得变量")
@Data
public class Variable  extends BaseEntity {

    @Column(columnDefinition = "varchar(100) COMMENT '变量名'")
    private String name;

    @Column(columnDefinition = "varchar(100) COMMENT '中文名'")
    private String alias;

    @Column(columnDefinition = "varchar(100) COMMENT '默认值'")
    private String defualt;

    @Column(name = "play_tpye", columnDefinition = "varchar(100) COMMENT '播放方式'")
    private String playType;

    @Column(name="scene_type",columnDefinition = "varchar(100) COMMENT '场景类型'")
    private String sceneType;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "variable_company", joinColumns = @JoinColumn(name = "variable_id"), inverseJoinColumns = @JoinColumn(name = "company_id"))
    private Set<Company> companies;

    @Column(columnDefinition = "varchar(20) comment '来源方向(企业方还是超级管理)'")
    @Enumerated(EnumType.STRING)
    private SourceType source;

    @Column(name="use_count",columnDefinition = "int COMMENT '被使用次数'")
    private  Integer useCount;

    @Column(columnDefinition = "varchar(64) COMMENT '创建者id'")
    private String createrId;

    @Column(name="is_share",columnDefinition = "int COMMENT '是否共享变量'")
    private  Boolean isShare;

    @Column(name="is_fixed",columnDefinition = "int COMMENT '是否固定导入数据列'")
    private Boolean isFixed;

}
